﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;

namespace GameLibrary.Map
{
    [Serializable]
    public class Path
    {
        private List<Position> path; // path between two citis in two regions
        public ReadOnlyCollection<Position> PositionList
        {
            get
            {
                return new ReadOnlyCollection<Position>(this.path);
            }
        }
        public Position Fist { get { return path.First(); } }
        public Position Last { get { return path.Last(); } }
        public double TotalMoveCost{
            get{
                double total = 0;
                path.ForEach(n=>
                    total += GameMap.UniqueInstance.GetMoveCost(n));
                return total;
            }
        }
        /// <summary>
        /// store a series position as a path.
        /// </summary>
        /// <param name="path"></param>
        public Path(List<Position> path)
        {
            this.path = path;
            this.path.RemoveAt(0);
        }

        public void RemoveFirst()
        {
            this.path.RemoveAt(0);
        }

    }
}
